using System;
using System.IO;
using System.Reflection;

namespace GoldStone.Common.Utils {
    public static class FileUtil {
        public static DirectoryInfo CreateFolderIfNotExist(String path) {
            if (Directory.Exists(path)) {
                return new DirectoryInfo(path);
            }
            return Directory.CreateDirectory(path);
        }

        public static void CreateFileIfNotExist(String path) {
            if (File.Exists(path)) {
                return;
            }
            using (File.Create(path)) {
            }
        }

        public static String ModuleFolder() {
            return Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase).Replace("file:\\", "");
        }
    }
}